home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Samples / C++ / Direct3D / DXTex / dxtexdoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-09-27  |  4.2 KB  |  108 lines

  1. // dxtexDoc.h : interface of the CDxtexDoc class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. #if !defined(AFX_DXTXDOC_H__712C53CF_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
  6. #define AFX_DXtxDOC_H__712C53CF_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_
  7.  
  8. #if _MSC_VER > 1000
  9. #pragma once
  10. #endif // _MSC_VER > 1000
  11.  
  12.  
  13. class CDxtexDoc : public CDocument
  14. {
  15. protected: // create from serialization only
  16.     CDxtexDoc();
  17.     DECLARE_DYNCREATE(CDxtexDoc)
  18.  
  19. public:
  20. // Overrides
  21.     // ClassWizard generated virtual function overrides
  22.     //{{AFX_VIRTUAL(CDxtexDoc)
  23.     public:
  24.     virtual BOOL OnNewDocument();
  25.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  26.     virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
  27.     virtual void SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU = TRUE);
  28.     //}}AFX_VIRTUAL
  29.  
  30. // Implementation
  31. public:
  32.     HRESULT LoadAlphaBmp(CString& strPath);
  33.     VOID GenerateMipMaps(VOID);
  34.     HRESULT ChangeFormat(LPDIRECT3DBASETEXTURE9 ptexCur, D3DFORMAT fmt, 
  35.                          LPDIRECT3DBASETEXTURE9* pptexNew);
  36.     HRESULT Compress(D3DFORMAT fmt, BOOL bSwitchView);
  37.     HRESULT Resize(DWORD dwWidthNew, DWORD dwHeightNew);
  38.     DWORD NumMips(VOID);
  39.     LPDIRECT3DBASETEXTURE9 PtexOrig(VOID) { return m_ptexOrig; }
  40.     LPDIRECT3DBASETEXTURE9 PtexNew(VOID) { return m_ptexNew; }
  41.     DWORD DwWidth(VOID) { return m_dwWidth; }
  42.     DWORD DwHeight(VOID) { return m_dwHeight; }
  43.     DWORD DwDepth(VOID) { return m_dwDepth; }
  44.     DWORD DwDepthAt(LONG lwMip);
  45.     BOOL TitleModsChanged(VOID) { return m_bTitleModsChanged; }
  46.     VOID ClearTitleModsChanged(VOID) { m_bTitleModsChanged = FALSE; }
  47.     virtual ~CDxtexDoc();
  48.     void OpenSubsurface(D3DCUBEMAP_FACES FaceType, LONG lwMip, LONG lwSlice);
  49.     void OpenAlphaSubsurface(D3DCUBEMAP_FACES FaceType, LONG lwMip, LONG lwSlice);
  50.     void OpenCubeFace(D3DCUBEMAP_FACES FaceType);
  51.     void OpenAlphaCubeFace(D3DCUBEMAP_FACES FaceType);
  52.     BOOL IsCubeMap(VOID) { return (m_dwCubeMapFlags > 0); }
  53.     BOOL IsVolumeMap(VOID) { return (m_dwDepth > 0); }
  54. #ifdef _DEBUG
  55.     virtual void AssertValid() const;
  56.     virtual void Dump(CDumpContext& dc) const;
  57. #endif
  58.  
  59. // Generated message map functions
  60. protected:
  61.     //{{AFX_MSG(CDxtexDoc)
  62.     afx_msg void OnFileOpenAlpha();
  63.     afx_msg void OnGenerateMipMaps();
  64.     afx_msg void OnFormatDxt1();
  65.     afx_msg void OnFormatDxt2();
  66.     afx_msg void OnFormatDxt3();
  67.     afx_msg void OnFormatDxt4();
  68.     afx_msg void OnFormatDxt5();
  69.     afx_msg void OnFormatChangeCubeMapFaces();
  70.     afx_msg void OnUpdateFileOpenAlpha(CCmdUI* pCmdUI);
  71.     afx_msg void OnUpdateFormatGenerateMipmaps(CCmdUI* pCmdUI);
  72.     afx_msg void OnUpdateFormatChangeCubeMapFaces(CCmdUI* pCmdUI);
  73.     afx_msg void OnFormatMakeIntoVolumeMap();
  74.     afx_msg void OnUpdateFormatMakeIntoVolumeMap(CCmdUI* pCmdUI);
  75.     afx_msg void OnFormatChangeSurfaceFmt();
  76.     afx_msg void OnFormatResize();
  77.     afx_msg void OnUpdateFormatResize(CCmdUI* pCmdUI);
  78.     //}}AFX_MSG
  79.     DECLARE_MESSAGE_MAP()
  80.  
  81. private:
  82.     LPDIRECT3DBASETEXTURE9 m_ptexOrig;
  83.     LPDIRECT3DBASETEXTURE9 m_ptexNew;
  84.     DWORD m_dwWidth;
  85.     DWORD m_dwHeight;
  86.     DWORD m_dwDepth; // For volume textures
  87.     DWORD m_numMips;
  88.     DWORD m_dwCubeMapFlags;
  89.     BOOL m_bTitleModsChanged;
  90.  
  91.     CDxtexApp* PDxtexApp(VOID) { return (CDxtexApp*)AfxGetApp(); }
  92.     HRESULT LoadAlphaIntoSurface(CString& strPath, LPDIRECT3DSURFACE9 psurf);
  93.     HRESULT LoadVolumeSliceFromSurface(LPDIRECT3DVOLUME9 pVolume, UINT iSlice, LPDIRECT3DSURFACE9 pSurf);
  94.     HRESULT LoadSurfaceFromVolumeSlice(LPDIRECT3DVOLUME9 pVolume, UINT iSlice, LPDIRECT3DSURFACE9 psurf);
  95.     HRESULT BltAllLevels(D3DCUBEMAP_FACES FaceType, LPDIRECT3DBASETEXTURE9 ptexSrc, 
  96.         LPDIRECT3DBASETEXTURE9 ptexDest);
  97.     BOOL PromptForBmp(CString* pstrPath);
  98.     D3DFORMAT GetFormat(LPDIRECT3DBASETEXTURE9 ptex);
  99.     HRESULT EnsureAlpha(LPDIRECT3DBASETEXTURE9* pptex);
  100. };
  101.  
  102. /////////////////////////////////////////////////////////////////////////////
  103.  
  104. //{{AFX_INSERT_LOCATION}}
  105. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  106.  
  107. #endif // !defined(AFX_DXTXDOC_H__712C53CF_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
  108.